window.addEventListener('message', function(event) {
try {
  var data = JSON.parse(event.data);
  var token = data.token;
  console.log(data); // 输出localStorage的值
  // 存储简单数据
  localStorage.setItem('token', token);
  localStorage.setItem('rootUrl', data.rootUrl);
} catch (error) {
   console.error('JSON parse failed:', event.data);
}
});